package com.lyw.guide

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import coil.load
import com.blankj.utilcode.util.ThreadUtils
import com.lu.library.base.BaseActivity
import com.lu.library.ext.navigation
import com.lu.library.kv.KVDelegate
import com.lyw.guide.databinding.ActivitySplashBinding
import com.lyw.login_api.LoginRoutePaths

class SplashActivity() : BaseActivity<ActivitySplashBinding>() {
//    override fun onCreate(savedInstanceState: Bundle?) {
//        super.onCreate(savedInstanceState)
//        enableEdgeToEdge()
//        setContentView(R.layout.activity_splash)
//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
//            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
//            insets
//        }
//    }

    override var statusBarDarkFont: Boolean = false
    override fun layoutResId() = R.layout.activity_splash

    override var isApplySystemFits: Boolean = false
    override fun initViews() {
        super.initViews()
        binding.img.load("https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/preview_jpg/ee46b7ba44bf2a9b0aba2f7190b50ac0.jpg")

        ThreadUtils.runOnUiThreadDelayed({

            var isGuide by KVDelegate<Boolean>(key=Constants.Key.IS_GUIDE,def=false)
            if (!isGuide) {
                startActivityAndSelfFinish(GuideActivity::class.java)
                isGuide = true
            }else{
                LoginRoutePaths.PATH_LOGIN.navigation()
                finish()
            }
        },2000)
    }
    override fun initData() {
    }
}